/**
 * Created by lwy on 2017/8/4.
 */


$(function(){
    doPeople();
})

function doPeople(){
    $.ajax({
        url:'/goodsReserveC/personNum.json',
        dataType:'json',
        data:{

        },
        type:'post',
        success:function(data){
            if(data.code==1){
                $('.residueCount').empty();
                var data = data.datas;
                var reserveNum = parseInt(data.personNum);
                var oneReserveNum = (reserveNum+'').split('');
                if(reserveNum>=0&&reserveNum<=9){
                    $('<span>0</span><span>0</span><span>'+reserveNum+'</span>').appendTo($('.residueCount'));
                }
                if(reserveNum>=10&&reserveNum<=99){
                    $('<span>0</span><span>'+oneReserveNum[0]+'</span><span>'+oneReserveNum[1]+'</span>').appendTo($('.residueCount'));
                }
                if(reserveNum>=100&&reserveNum<=999){
                    $('<span>'+oneReserveNum[0]+'</span><span>'+oneReserveNum[1]+'</span><span>'+oneReserveNum[2]+'</span>').appendTo($('.residueCount'));
                }
                if(reserveNum>=1000){
                    $('<span>9</span><span>9</span><span>9</span>').appendTo($('.residueCount'));
                }
                $('#day').html(data.day);
            }
        }
    })
}
var i = setInterval(doPeople,30000);